Repository navigation
26_deconstruct: count snarl IDs with grep -c, not a quoted wc -l - #5108
Open
glennhickey wants to merge 1 commit into
Open
glennhickey wants to merge 1 commit into
glennhickey wants to merge 1 commit into
Conversation
BSD wc -l right-aligns its count in an eight-wide field, so "$(... | wc -l)" is " 1", and bash-tap's is() compares strings without trimming. The assertion fails wherever /usr/bin/wc is the wc on the PATH. make test and the macos CI job never see it: the Makefile puts Homebrew's coreutils gnubin ahead of /usr/bin, so both get GNU wc, which does not pad. It fails when prove is run on a single test file from a shell without that PATH, which is how CLAUDE.md says to run one test file. The other twenty wc -l assertions in this file are unquoted, so word splitting strips the padding and they pass either way; this was the only quoted one. grep -c . counts the same lines here, and is the form this file already uses thirty-one times, including once inside a quoted command substitution. It is also stricter: were a record's ID column ever empty, wc -l would count the blank line and let the assertion pass with no IDs in it at all, where grep -c . returns 0 and fails. Other test files still hold quoted wc -l assertions with the same problem. They are left alone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BSD
wc -lright-aligns its count in an eight-wide field, so"$(... | wc -l)"is" 1", and bash-tap'sis()compares strings without trimming. One assertion in26_deconstruct.tis written with the command substitution quoted, so it fails wherever/usr/bin/wcis thewcon the PATH.make testand the macos CI job never see it: the Makefile prepends Homebrew's coreutilsgnubin, so both get GNUwc. It fails whenproveis run on a single test file from a shell without that PATH, which is how CLAUDE.md says to run one test file. The other twentywc -lassertions in this file are unquoted, so word splitting strips the padding.grep -c .counts the same lines here and is the form this file already uses thirty-one times, including once inside a quoted command substitution. It is also stricter: were a record's ID column ever empty,wc -lwould count the blank line and let the assertion pass with no IDs in it at all.Other test files still hold quoted
wc -lassertions with the same problem. They are left alone.Tested with
prove t/26_deconstruct.ton macOS 15.5, with and withoutgnubinon the PATH.🤖 Generated with Claude Code